package untiring.services;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import untiring.interfaces.CommentDAO;
import untiring.interfaces.CommentService;
import untiring.models.CommentVO;

@Service("commentService")
public class CommentServiceImpl 
						implements CommentService {

	@Autowired
	private CommentDAO commentDAO;
	
	@Override
	public String newComment(CommentVO c) {
		String result = "board/view";
		if (commentDAO.insertComment(c))
			result = "redirect:/board/view.mvc?bno="+ c.getBno();
		return result;
	}

	@Override
	public List<CommentVO> readComment(String bno) {
		return commentDAO.selectComment(bno);
	}

	@Override
	public String newReply(CommentVO c) {
		String result = "board/view";
		if (commentDAO.insertReply(c))
			result = 
			"redirect:/board/view.mvc?bno="+c.getBno();
		return result;
	}

}







